package com.one.service;


import com.one.bean.Cart;


import com.one.bean.Product;
import com.one.util.RequestReturn;
import com.one.vo.ProductParamVo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * Create on 2022-01-20
 * <p>
 * Author: LiangWei
 * <p>
 * Description: 抢购与购物车模块远程调用
 **/
@FeignClient(name = "street-orderFlashSale")
public interface OrderFlashSaleService {
    /**
     *  下单抢购业务
     */
    @PostMapping("/orderFlashSale")
    RequestReturn<String> orderFlashSale(@RequestBody ProductParamVo productParamVo);

    /**
     *  微信支付业务
     */
    @GetMapping("/wxPay")
    RequestReturn<String> wxPay(@RequestParam("userId") Integer userId,
                                @RequestParam("orderNo") String orderNo,
                                @RequestParam("consigneeId") Integer consigneeId,
                                @RequestParam("ticketId") Integer ticketId,
                                @RequestParam("token") String token);

    /**
     *  普通下单业务
     */
    @PostMapping("/commonOrder")
    RequestReturn<String> commonOrder(@RequestBody List<ProductParamVo> productParamVoList);
    /**
     *  添加购物车业务
     */
    @PostMapping("/addProductToCart")
    RequestReturn<Product> addProductToCart(@RequestBody ProductParamVo productParamVo);


    /**
     *  删除单个购物车业务
     */
    @DeleteMapping("/deleteCart")
    RequestReturn<String> deleteCart(@RequestParam("cartId") Integer cartId);

    /**
     *  批量删除购物车业务
     */
    @DeleteMapping("/deleteManyCarts")
    RequestReturn<String> deleteManyCarts(@RequestParam("cartIdList") List<Integer> cartIdList);

    /**
     *  查询用户全部购物车业务
     */
    @GetMapping("/selectCartsByUserId")
    RequestReturn<List<Cart>> selectCartsByUserId();

    /**
     *  很久用户id删除所有的购物车
     */
    @DeleteMapping("/deleteAllCartsByUserId")
    RequestReturn<String> deleteAllCartsByUserId();

    /**
     *  更新购物车商品数量信息
     */
    @PostMapping("/updateProductNum")
    RequestReturn<Cart> updateProductNum(@RequestParam("productNum") Integer productNum,@RequestParam("cartId") Integer cartId);

    /**
     *  将购物车的商品添加到收藏
     */
    @PostMapping("/addToCollect")
    RequestReturn<String> addToCollect(@RequestParam("productId") Integer productId);
}
